package Comp;
import java.awt.*;

import javax.swing.ImageIcon;
import javax.swing.JPanel;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
public class mingi_comp extends JPanel{
	//Image img;
	public static JPanel mingiChart() {
		
		 JFreeChart chart = new mingi_comp().getChart();
		 ChartPanel retChartPanel = new ChartPanel(chart);
		 retChartPanel.setPreferredSize(new Dimension(250,220));
	        
	        return retChartPanel;
	
	}
	
	 public JFreeChart getChart() {

	        JFreeChart chart = ChartFactory.createBarChart("MG Apperance",
	                                "Category", 
	                                "Value",
	                                getDataSet(),
	                                PlotOrientation.VERTICAL,
	                                true,
	                                true, 
	                                false); 
	       
	        return chart;
	    }

	  
	    private DefaultCategoryDataset getDataSet() {
	        DefaultCategoryDataset dataSet = new DefaultCategoryDataset();
	        String category1 = "ABSENT";
	        String category2 = "LATE";
	        String test1 = "AUG";
	        String test2 = "SEP";
	        String test3 = "OCT";
	        String test4 = "NOV";
	        String test5 = "DEC";
	       
	    
	        dataSet.addValue(0, category1, test1);
	        dataSet.addValue(5, category1, test2);
	        dataSet.addValue(5, category1, test3);
	        dataSet.addValue(49, category1, test4);
	        dataSet.addValue(50, category1, test5);
	     
	        dataSet.addValue(0, category2, test1);
	        dataSet.addValue(5, category2, test2);
	        dataSet.addValue(5, category2, test3);
	        dataSet.addValue(50, category2, test4);
	        dataSet.addValue(50, category2, test5);    
	       
	        return dataSet;
	    }   
	   
	    

 /*
 public void paint(Graphics g) {
  g.drawImage(this.icon, 0, 0, 250, 250, this);
 }
 */

}